package com.lagou.base;

import com.alibaba.fastjson.JSONObject;

/**
 * 状态码
 */

public enum StatusCode {
    SUCCESS(1,"success"),FAIL(0,"fail");
    // 定义属性
    private int code;
    private String message;

    StatusCode() {
    }

    StatusCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    // 输出为json格式
    @Override
    public String toString() {
        JSONObject jb = new JSONObject();
        jb.put("status",code);
        jb.put("msg",message);
        return jb.toString();
    }
}
